﻿<UserControl x:Class="OI.Views.MashupView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:Media="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions" mc:Ignorable="d"
    d:DesignHeight="400" d:DesignWidth="400">
    
    <!--MAIN MASHUP AREA-->
    <Grid Style="{StaticResource MainSubcontent}" Margin="4,12,4,4">
        <!--TWO PRIMARY AREAS-->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <!--LEFT AREA GRID-->
        <Grid Grid.Column="0" x:Name="LeftAreaGrid" Width="{StaticResource MashupPanelSize}">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            
            <!--LEGEND-->
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <ContentControl Name="LegendArea" Grid.Row="0"
                            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
            </ScrollViewer>

            <!--TOOLBOX-->
            <ContentControl Name="ToolboxArea" Grid.Row="1"
                            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
        </Grid>

        <Grid Grid.Column="1" x:Name="RightAreaGrid" Margin="4,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            
            <!--MAP-->
            <ContentControl x:Name="MapArea" Grid.Row="0"
                            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>

            <!--MAP STATUS-->
            <Border Grid.Row="0" Background="White" CornerRadius="3"
                    Opacity="0.5" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="4">
                <TextBlock Name="MapStatus" Style="{StaticResource MenuItems}" Margin="4"/>
            </Border>

            <!--EXPANDERS-->
            <Controls:Expander Grid.Row="0" ExpandDirection="Right" IsExpanded="{Binding LegendAreaExpanded, Mode=TwoWay}"
                               HorizontalAlignment="Left" VerticalAlignment="Center" 
                               Margin="4,0,0,0" Background="Transparent" Style="{StaticResource OIExpanderStyle}">
            
                <Controls:Expander.Resources>
                    <Storyboard x:Key="CloseL">
                            <DoubleAnimation Storyboard.TargetName="LeftAreaGrid" Storyboard.TargetProperty="Width" Duration="0:0:0.25" To="0">
                        </DoubleAnimation>
                    </Storyboard>
                    <Storyboard x:Key="OpenL">
                        <DoubleAnimation Storyboard.TargetName="LeftAreaGrid" Storyboard.TargetProperty="Width" Duration="0:0:0.5" To="{StaticResource MashupPanelSize}">
                            <DoubleAnimation.EasingFunction>
                                <BackEase EasingMode="EaseOut"
										      Amplitude="0.5" />
                            </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                    </Storyboard>
                </Controls:Expander.Resources>

                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Expanded">
                        <Media:ControlStoryboardAction Storyboard="{StaticResource OpenL}"/>
                    </i:EventTrigger>
                    <i:EventTrigger EventName="Collapsed">
                        <Media:ControlStoryboardAction Storyboard="{StaticResource CloseL}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            
            </Controls:Expander>

            <Controls:Expander Grid.Row="0" ExpandDirection="Up" IsExpanded="{Binding DataAreaExpanded, Mode=TwoWay}"
                               HorizontalAlignment="Center" VerticalAlignment="Bottom" 
                               Margin="0,0,0,4" Background="Transparent" Style="{StaticResource OIExpanderStyle}">

                <Controls:Expander.Resources>
                    <Storyboard x:Key="CloseD">
                        <DoubleAnimation Storyboard.TargetName="DataAreaGrid" Storyboard.TargetProperty="Height" Duration="0:0:0.25" To="0">
                        </DoubleAnimation>
                    </Storyboard>
                    <Storyboard x:Key="OpenD">
                        <DoubleAnimation Storyboard.TargetName="DataAreaGrid" Storyboard.TargetProperty="Height" Duration="0:0:0.5" To="{StaticResource MashupPanelSize}">
                            <DoubleAnimation.EasingFunction>
                                <BackEase EasingMode="EaseOut"
										      Amplitude="0.5" />
                            </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                    </Storyboard>
                </Controls:Expander.Resources>

                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Expanded">
                        <Media:ControlStoryboardAction Storyboard="{StaticResource OpenD}"/>
                    </i:EventTrigger>
                    <i:EventTrigger EventName="Collapsed">
                        <Media:ControlStoryboardAction Storyboard="{StaticResource CloseD}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>

            </Controls:Expander>
        
            <!--RESULTSET-->
            <Grid x:Name="DataAreaGrid" Grid.Row="1" Height="0">
                <ContentControl Name="DataArea" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
